package com.slz3.business.module.messageManagement.mesUser.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesUser.domain.MesUser;
import com.slz3.business.module.messageManagement.mesUser.domain.MesUserFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesUserTransactionalServiceImpl implements MesUserTransactionalService {

    @Override
    public MesUser modify(MesUser mesUserNew) {
        Repositorys.mesUser.test();
        Repositorys.mesUser.save(MesUserFactory.initBaseFields());
        System.err.println(1/0);
        mesUserNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesUser.saveAndFlush(mesUserNew);
    }

    @Override
    public List<MesUser> batchModify(List<MesUser> mesUserList) {
        return Repositorys.mesUser.saveAll(mesUserList);
    }
}
